
<!DOCTYPE html>
{% load staticfiles %}
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="static/favicon.ico">
    <title>智联管理系统</title>
    <!-- Bootstrap -->
    <link href="static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="static/bootstrap/css/ligh-broadside.css" rel="stylesheet">
    <link href="http://v3.bootcss.com/examples/dashboard/dashboard.css" rel="stylesheet">
    <script src="http://v3.bootcss.com/assets/js/ie-emulation-modes-warning.js"></script>
    <!--<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">-->
    <link rel="stylesheet" href="static/bootstrap/css/jquery-ui.css">

    <link rel="stylesheet" href="static/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" href="static/bootstrap/css/bootstrap-datetimepicker.min.css" media="screen"/>
    <style type="text/css">
        .select{
            width: 15%;
            height: 34px;
            display: inline;
        }
        .input{
            width: 30%;
            height: 34px;
            display: inline;
        }
        .text_area {
            width: 30%;
            height: 500px;
        }
        .td {
            border-top: hidden;
        }
    </style>
</head>

<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/index">外网运维管理系统</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="/chpasswd">更改密码</a></li>
            <li><a href="/logout">退出</a></li>
          </ul>
        </div>
      </div>
    </nav>
  <form  method="get" action="/work_admin_details">
   <br>
   <br>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-2" style="width:280px" >
        <!--<ul class="nav nav-list"> -->
        <ul id="main-nav" class="nav nav-tabs nav-stacked" style="">
          <li class="active">
              <a href="/index"><i class="glyphicon glyphicon-th-large"></i>外网运维管理系统</a>
          </li>
          <li><a href="#workSetting" class="nav-header collapsed" data-toggle="collapse">
              <i class="glyphicon glyphicon-cog"></i>加班管理
              <span class="pull-right glyphicon glyphicon-chevron-down"></span></a>
              <ul id="workSetting" class="nav nav-list collapse secondmenu" style="height: 0px;">
                  <li><a href="/work_add" class="glyphicon glyphicon-fire">加班管理</a></li>
                  <li><a href="/work_details" class="glyphicon glyphicon-unchecked">加班查询</a></li>
              </ul>
          </li>
        </ul> 
      </div>

    <div class='col-md-9'>
      <h2>加班查询</h2>
        <tr>
         <!--<ul class="nav nav-tabs nav-stacked">-->
        <p>
                      {{work_time}}
        </p>
        </tr>
          <input  class="form-control input" style="width:200px" type="text"  placeholder="姓名" id="search"  name="search"  />
          <input  class="form-control input" style="width:200px" type="text"  placeholder="开始时间" id="start_time"  name="start_time"  />
          <input  class="form-control input" style="width:200px" type="text"  placeholder="结束时间" id="end_time"  name="end_time"  />
          <input  class="btn btn-primary btn-flat" type="submit" value="Search">
          <br>
          <br>

        <!--<div class="col-sm-9 col-sm-offset-3 col-md-9 col-md-offset-2 main">-->
          <div class="table-responsive">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>序号</th>
                  <th>员工姓名</th>
                  <th>开始时间</th>
                  <th>结束时间</th>
                  <th>持续时间(H)</th>
                  <th>所选类型</th>
                  <th>研发对接人</th>
                  <th>原因说明</th>
                  <th>填表时间</th>
                  <th>更改操作</th>
                </tr>
              </thead>
              <tbody>

                {% for list in work_his %}
                    <tr>
                        <td>
                            {{forloop.counter}}
                        </td>
			<td>
			    {{list.staff_name}}
			</td>
                        <td>
                      	    {{list.start_time|date:"Y-m-d H:i"}}
                        </td>
                        <td>
                      	    {{list.end_time|date:"Y-m-d H:i"}}
                        </td>
			<td>
			    {{list.duration_number}}
			</td>
			<td>
			    {{list.type_name}}
			</td>
			<td>
		    	     {{list.development_name}}
			</td>
                        <td>
                      	    {{list.reason_explain}}
                        </td>
			<td>
			     {{list.update_time|date:"Y-m-d H:i:s"}}
			</td>
                        <td>
                           <button  type="button" class="btn btn-primary" onclick="asd(this)">删除</button>
                        </td>

                    </tr>
                {% endfor %}

              </tbody>
            </table>
            <p>
            {% if work_his.has_previous %}
              <a href="?page={{ work_his.previous_page_number }}&search={{staff_name}}&start_time{{start_name}}=&end_time={{end_time}}">Previous</a>
              {% endif %}
              {# work_his.paginator.number_pages 返回总页数 #}
              Page {{ work_his.number }} of {{ work_his.paginator.num_pages }}.
            {% if work_his.has_next %}
              <a href="?page={{ work_his.next_page_number }}&search={{staff_name}}&start_time={{start_time}}&end_time={{end_time}}">Next</a>
            {% endif %}
              <a href="?page=all&search={{staff_name}}&start_time={{start_time}}&end_time={{end_time}}">All</a>
            </p>
          </div>
        </div>
        </div>
      </div>
    </div>
   </div>
    </form>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
   <script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
   <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

   <script type="text/javascript" src="static/bootstrap/js/bootstrap.min.js"></script>
   <script type="text/javascript" src="static/bootstrap/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
   <script type="text/javascript" src="static/bootstrap/js/locales/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>

  </body>
<script type="text/javascript">
    $(function () {
        $('#start_time').datetimepicker({
            minView: "month",
            format: 'yyyy-mm-dd 00:00',
            autoclose: true,
        });
    });
</script>

<script type="text/javascript">
    $(function () {
        $('#end_time').datetimepicker({
            minView: "month",
            format: 'yyyy-mm-dd 23:59',
            autoclose: true,
        });
    });
</script>
<script type="text/javascript">
if ('{{search_name}}')
    $("#search").attr("value",'{{search_name}}');
if ('{{start_time}}')
    $("#start_time").attr("value",'{{start_time}}');
if ('{{end_time}}')
    $("#end_time").attr("value",'{{end_time}}');
</script>
   <script>
   function asd(args){
       var staff_name = $(args).parent().parent().find("td").eq(1).text()
       var start_time = $(args).parent().parent().find("td").eq(2).text()
       var end_time = $(args).parent().parent().find("td").eq(3).text()
       var msg = "你想删除这条纪录吗？\n\n请确认！"; 
       if (confirm(msg)==true){ 
           $.ajax({
               url: "/work_delete",
               type: "POST",
               timeout : 0,
               dataType: "json",
               data: {
                   "staff_name": staff_name,
                   "start_time": start_time,
                   "end_time": end_time,
               },
               success: function (data){
                   console.log(data)
                   if (data == 0) {
                        window.location.href = '/work_details';
                   }      
               },
               error: function(data){
                   console.log(data)
                   if (data != 0) {
                        alert("删除失败");
                   }
               },
           })
       }
       else{ 
           window.location.href = '/work_details';
       } 
   }
   </script>


</html>

